<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <script>
        window.onload=function(){
            //全局声明组件
            Vue.component('my-child',{
                data(){
                    return{
                        substr:hello
                    }
                },
                methods:{},
                props:['msg','str'],
                template:`
                    <div>
                        <h1>child-{{msg}}-{{str}}</h1>
                    </div>
                `
            });
            new Vue({
                el:'#app',
                data:{},
                methods:{},
                components:{
                    'my-parent':{
                        data(){
                            return{
                                num:10
                            }
                        },
                        template:`
                            <div>
                                <h1>parent</h1>
                                <my-child msg='父组件传递的数据' :str='num'></my-child>
                            </div>
                        `
                    }
                }
            });
        }
    </script>
</head>
<body>
    <div id="app">
        <my-parent></my-parent>
    </div>
</body>
</html>